import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/views/Layout/index.vue";

const routes = [
    {
        path: "/",
        component: Layout,
        redirect: "/index",
        children: [
            // index
            {
                path: "index",
                name: "Index",
                redirect: "/index/recommend",
                component: () => import("@/views/Index/index.vue"),
                children: [
                    {
                        path: "recommend",
                        name: "Recommend",
                        component: () => import("@/views/Index/Recommend/index.vue"),
                    },
                    {
                        path: "original",
                        name: "Original",
                        component: () => import("@/views/Index/Original/index.vue"),
                    },
                    {
                        path: "course",
                        name: "Course",
                        component: () => import("@/views/Index/Course/index.vue"),
                    },
                    {
                        path: "specialTopic",
                        name: "SpecialTopic",
                        component: () => import("@/views/Index/SpecialTopic/index.vue"),
                    },
                    {
                        path: "information",
                        name: "Information",
                        component: () => import("@/views/Index/Information/index.vue"),
                    },
                    {
                        path: "attention",
                        name: "Attention",
                        component: () => import("@/views/Index/Attention/index.vue"),
                    },
                ],
            },
            // discovery
            {
                path: "discovery",
                name: "Discovery",
                component: () => import("@/views/Discovery/index.vue"),
                redirect: "/discovery/vip_zone",
                children: [
                    {
                        path: "vip_zone",
                        name: "Vip_zone",
                        component: () => import("@/views/Discovery/Vip_zone/index.vue"),
                    },
                    {
                        path: "video_courses",
                        name: "Video_courses",
                        component: () => import("@/views/Discovery/Video_courses/index.vue"),
                    },
                    {
                        path: "live_courses",
                        name: "Live_courses",
                        component: () => import("@/views/Discovery/Live_courses/index.vue"),
                    },
                    {
                        path: "major_courses",
                        name: "Major_courses",
                        component: () => import("@/views/Discovery/Major_courses/index.vue"),
                    },
                    {
                        path: "zone_list",
                        name: "Zone_list",
                        component: () => import("@/views/Discovery/Zone_list/index.vue"),
                    },
                ],
            },
            // training
            {
                path: "training",
                name: "Training",
                component: () => import("@/views/Training/index.vue"),
                children: [
                    {
                        path: "mediaCache",
                        name: "MediaCache",
                        component: () => import("@/views/Training/MediaCache/index.vue"),
                    },
                    {
                        path: "collections",
                        name: "Collections",
                        component: () => import("@/views/Training/Collections/index.vue"),
                    },
                    {
                        path: "viewRecords",
                        name: "ViewRecords",
                        component: () => import("@/views/Training/View_records/index.vue"),
                        meta: { title: ["资源动态"] },
                    },
                ],
            },

            // communication
            {
                path: "/communication",
                name: "Communication",
                redirect: "/communication/systemNote",
                component: () => import("@/views/Communication/index.vue"),
                children: [
                    {
                        path: "systemNote",
                        name: "SystemNote",
                        component: () => import("@/views/Communication/SystemNote/index.vue"),
                    },
                    {
                        path: "interactNote",
                        name: "InteractNote",
                        component: () => import("@/views/Communication/InteractNote/index.vue"),
                    },
                    {
                        path: "orderNote",
                        name: "OrderNote",
                        component: () => import("@/views/Communication/OrderNote/index.vue"),
                    },
                ],
            },
            // center
            {
                path: "center",
                name: "Center",
                component: () => import("@/views/Center/index.vue"),
                redirect: "/Center/Deposit",
                children: [
                    {
                        path: "deposit",
                        name: "Deposit",
                        component: () => import("@/views/Center/Deposit/index.vue"),
                        meta: { title: ["资源动态"] },
                    },

                    {
                        path: "my_member",
                        name: "My_member",
                        component: () => import("@/views/Center/My_member/index.vue"),
                        meta: { title: ["我的会员"] },
                    },

                    {
                        path: "dynamics",
                        name: "Dynamics",
                        component: () => import("@/views/Center/Dynamics/index.vue"),
                        meta: { title: ["我的保证金"] },
                    },
                    {
                        path: "wallet",
                        name: "Wallet",
                        component: () => import("@/views/Center/Wallet/index.vue"),
                        meta: { title: ["我的钱包"] },
                    },
                    {
                        path: "coupons",
                        name: "Coupons",
                        component: () => import("@/views/Center/Coupons/index.vue"),
                        meta: { title: ["我的优惠劵"] },
                    },
                    {
                        path: "edit_info",
                        name: "Edit_info",
                        component: () => import("@/views/Center/Edit_info/index.vue"),
                        meta: { title: ["编辑资料"] },
                    },
                    {
                        path: "buyer",
                        name: "Buyer",
                        redirect: "/center/buyer/my_order",
                        component: () => import("@/views/Center/Buyer/index.vue"),
                        meta: { title: ["全部订单", "待付款", "待评价", "待服务/发货", "待确认", "退款/售后"] },
                        children: [
                            {
                                path: "my_order",
                                name: "My_order",
                                component: () => import("@/views/Center/Buyer/My_order/index.vue"),
                                mest: { title: ["我买的订单"] },
                            },
                        ],
                    },
                    {
                        path: "seller",
                        name: "Seller",
                        component: () => import("@/views/Center/Seller/index.vue"),
                        children: [
                            {
                                path: "orders_manager",
                                name: "Orders_manager",
                                component: () => import("@/views/Center/Seller/Orders_manager/index.vue"),
                                meta: { title: ["全部订单", "待付款", "待评价", "待服务/发货", "待确认", "退款/售后"] },
                            },
                            {
                                path: "goods_manager",
                                name: "Goods_manager",
                                component: () => import("@/views/Center/Seller/Goods_manager/index.vue"),
                                meta: { title: ["全部商品", "线下视频", "视频课", "直播课"] },
                            },
                            {
                                path: "customers_manager",
                                name: "customers_manager",
                                component: () => import("@/views/Center/Seller/customers_manager/index.vue"),
                                meta: { title: ["全部客户"] },
                            },
                            {
                                path: "pending_payments_manager",
                                name: "Pending_payments_manager",
                                component: () => import("@/views/Center/Seller/Pending_payments_manager/index.vue"),
                                meta: { title: ["代收款！"] },
                            },
                            {
                                path: "minePreferentialManagement",
                                name: "MinePreferentialManagement",
                                component: () => import("@/views/Center/Seller/MinePreferentialManagement/index.vue"),
                                meta: { title: ["优惠价管理"] },
                            },
                            {
                                path: "mineReviewsManagement",
                                name: "MineReviewsManagement",
                                component: () => import("@/views/Center/Seller/MineReviewsManagement/index.vue"),
                                meta: { title: ["评价管理"] },
                            },
                        ],
                    },
                ],
            },
        ],
    },
    {
        path: "/login",
        name: "Login",
        component: () => import("@/views/Login/index.vue"),
    },
    {
        path: "/404",
        name: "404",
        component: () => import("@/views/404/index.vue"),
    },
    // 404 page must be placed at the end !!!
    { path: "/:pathMatch(.*)*", name: "404", component: () => import("@/views/404/index.vue") },
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;
